/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beanUser;

import com.matrimonysite.entity.UserRequestResponse;
import com.matrimonysite.sessionbean.UserRequestResponseFacade;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
/**
 *
 * @author khanhnguyen
 */
@ManagedBean (name = "RequestResponde")
@SessionScoped
public class RequestResponde {
    @EJB
    private  UserRequestResponseFacade userRequestRespondFacade;
    private UserRequestResponse userRequestResponse;
    List<UserRequestResponse> userRequestRespondList;

    public UserRequestResponse getUserRequestResponse() {
        return userRequestResponse;
    }

    public void setUserRequestResponse(UserRequestResponse userRequestResponse) {
        this.userRequestResponse = userRequestResponse;
    }
    
    /**
     * Creates a new instance of RequestResponde
     */
    public RequestResponde() {
        userRequestResponse = new UserRequestResponse();
        userRequestRespondFacade = new UserRequestResponseFacade();
    }
    
    public void creatUserRequestResponde(){
        Integer init = userRequestResponse.getRequestID();
        userRequestResponse.getRequestID();
        userRequestResponse.getReqUserID();
        userRequestResponse.getResUserID();
        userRequestResponse.getRelationship();
        userRequestResponse.getTitle();
        userRequestResponse.getComment();
        userRequestResponse.getRequestStatus();
        userRequestResponse.getResponseStatus();
        userRequestResponse.getCreatedDate();
        
        userRequestRespondFacade.create(userRequestResponse);
    }
    
    public void editUserRequestResponde(){
        userRequestRespondFacade.edit(userRequestResponse);
        FacesContext face = FacesContext.getCurrentInstance();
        face.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Update info Success.", "Update info Success."));
    }
    public void deleteUserRequestResponde(){
        Integer init = userRequestResponse.getRequestID();
        userRequestResponse.setRequestID(init);
        userRequestRespondFacade.remove(userRequestResponse);
    }
    
    public List<UserRequestResponse> getAllUserPersonal(){
        return userRequestRespondFacade.getAllUserRequestResponse();
    }
    
}
